//
//  MFPageTitleViewConfig.swift
//  MFPagingViewExample
//  GitHub: https://github.com/wwx1991/MFPagingView
//  Created by iOS on 2018/6/12.
//  Copyright © 2018年 GM. All rights reserved.
//

import UIKit

let SCREEN_WIDTH = UIScreen.main.bounds.size.width
let SCREEN_HEIGHT = UIScreen.main.bounds.size.height

let navHeight: CGFloat = {
    let statusBarHeight = UIApplication.shared.statusBarFrame.height
    if statusBarHeight == 20.0 {
        return 64
    }else {
        return 88
    }
}()

func colorWithRGB(r: CGFloat, g: CGFloat, b: CGFloat) -> UIColor {
    return UIColor(red: r/255.0, green: g/255.0, blue: b/255.0, alpha: 1)
}

class MFPageTitleViewConfig: NSObject {
    
    /** 是否显示底部分割线，默认为true */
    var showBottomSeparator: Bool = true
    /** 按钮之间的间距，默认为 20.0f */
    var spacingBetweenButtons: CGFloat = 0
    /** 标题文字字号大小，默认 15 号字体 */
    var titleFont: UIFont = UIFont.systemFont(ofSize: 15)
    /** 选中标题文字字号大小，默认 15 号字体  */
    var titleSelectFont: UIFont = UIFont.systemFont(ofSize: 15)
    /** 普通状态下标题按钮文字的颜色，默认为黑色 */
    var titleColor: UIColor = UIColor.black
    /** 选中状态下标题按钮文字的颜色，默认为红色 */
    var titleSelectedColor: UIColor = UIColor.red
    /** 指示器颜色，默认为红色 */
    var indicatorColor: UIColor = UIColor.red
    /** 指示器高度，默认3 */
    var indicatorHeight: CGFloat = 3
    
    
}

///用法

/**
 import UIKit

 class VCTwo: UIViewController {
     
     
     
     private lazy var pageTitleView: MFPageTitleView = {
         let config = MFPageTitleViewConfig()
         config.titleColor = colorWithRGB(r: 43, g: 43, b: 43)
         config.titleSelectedColor = colorWithRGB(r: 211, g: 0, b: 0)
         config.titleFont = UIFont.systemFont(ofSize: 14, weight: .regular)
         config.indicatorColor = colorWithRGB(r: 211, g: 0, b: 0)
         let pageTitleView = MFPageTitleView(frame: CGRect(x: 0, y: navHeight, width: SCREEN_WIDTH, height: 41), titles: ["关注", "推荐", "热点", "世界杯","全部"], config: config)
         pageTitleView.pageTitleViewDelegate = self
         return pageTitleView
     }()
     
     private lazy var pageContentView: MFPageContentView = {
         var childControllers = [UIViewController]()
         for _ in 0..<5 {
             let vc = UIViewController()
             let red: CGFloat = CGFloat(arc4random() % 256)
             let green: CGFloat = CGFloat(arc4random() % 256)
             let blue: CGFloat = CGFloat(arc4random() % 256)
             vc.view.backgroundColor = UIColor(red: red / 255.0, green: green / 255.0, blue: blue / 255.0, alpha: 1.0)
             childControllers.append(vc)
         }
         
         let pageContentViewY = pageTitleView.frame.maxY
         let pageContentView = MFPageContentView(frame: CGRect(x: 0, y: pageContentViewY, width: SCREEN_WIDTH, height: SCREEN_HEIGHT-pageContentViewY), parentVC: self, childVCs: childControllers)
         pageContentView.pageContentViewDelegate = self
         return pageContentView
     }()

     override func viewDidLoad() {
         super.viewDidLoad()
         view.backgroundColor = UIColor.white
         view.addSubview(pageTitleView)
         view.addSubview(pageContentView)
     }

 }

 extension VCTwo: MFPageTitleViewDelegate, MFPageContentViewDelegate {
     func selectedIndexInPageTitleView(pageTitleView: MFPageTitleView, selectedIndex: Int) {
         self.pageContentView.setPageContentViewCurrentIndex(currentIndex: selectedIndex)
     }
     func pageContentViewScroll(progress: CGFloat, originalIndex: Int, targetIndex: Int) {
         self.pageTitleView.setPageTitleView(progress: progress, originalIndex: originalIndex, targetIndex: targetIndex)
     }
 }

 */
